package cn.okcode.slowjson.ast;

import cn.okcode.slowjson.parser.Visitor;

/**
 * @author pyk13
 */
public class NumberNode extends AbstractNode<Number> {
    private final Number value;

    public NumberNode(Number value) {
        this.value = value;
    }

    @Override
    public Number getValue() {
        return value;
    }

    @Override
    public String stringValue() {
        if (value == null) {
            return "";
        }
        return String.valueOf(value);
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visit(this);
    }
}
